Skip to content

Conversation

@thecrypticace
Copy link
Contributor

Fixes #19239

@thecrypticace thecrypticace marked this pull request as ready for review October 31, 2025 18:21
@thecrypticace thecrypticace requested a review from a team as a code owner October 31, 2025 18:21
@coderabbitai
Copy link

coderabbitai bot commented Nov 11, 2025

Walkthrough

Adds an Exclamation enum variant (b'!') and parsing logic in arbitrary_property_machine.rs to accept a top-level !important sequence as an arbitrary-property value terminator only when not bracket-nested. Enhances the Ruby pre-processor to skip single/double-quoted string contents (with backslash escapes), convert # comments to spaces until newline, and refine %w, %W, %p delimiter handling using a bracket stack plus space/newline boundary rules. Removes nonfunctional annotation lines from a HAML test fixture and adds a CHANGELOG entry about skipping Ruby comments when checking class names.

Pre-merge checks

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'Skip comments in Ruby files when checking for class names' directly aligns with the main change of improving Ruby comment handling during content scanning to reduce false parsing warnings.
Description check ✅ Passed The PR description references issue #19239, which matches the linked issue addressing parsing warnings from Ruby RDoc syntax during content scanning.
Linked Issues check ✅ Passed The code changes address issue #19239 by improving Ruby comment and RDoc handling: explicit comment skipping in ruby.rs, arbitrary property value termination with '!important' support, and updated tests covering these scenarios.
Out of Scope Changes check ✅ Passed Changes to arbitrary_property_machine.rs for '!important' handling are closely related to resolving the RDoc parsing issue by enabling proper CSS value termination, while haml fixture changes are minimal cleanup.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f381118 and 7f34f3f.

📒 Files selected for processing (1)
  • crates/oxide/src/extractor/pre_processors/ruby.rs (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/oxide/src/extractor/pre_processors/ruby.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Linux
  • GitHub Check: Linux / oxide
  • GitHub Check: Linux / webpack
  • GitHub Check: Linux / upgrade
  • GitHub Check: Linux / cli
  • GitHub Check: Linux / vite
  • GitHub Check: Linux / postcss

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3cece1d and c19d255.

📒 Files selected for processing (3)
  • crates/oxide/src/extractor/arbitrary_property_machine.rs (3 hunks)
  • crates/oxide/src/extractor/pre_processors/ruby.rs (5 hunks)
  • crates/oxide/src/extractor/pre_processors/test-fixtures/haml/dst-17051.haml (0 hunks)
💤 Files with no reviewable changes (1)
  • crates/oxide/src/extractor/pre_processors/test-fixtures/haml/dst-17051.haml
🧰 Additional context used
🧬 Code graph analysis (1)
crates/oxide/src/extractor/pre_processors/ruby.rs (2)
crates/oxide/src/extractor/candidate_machine.rs (1)
  • next (29-169)
crates/oxide/src/extractor/string_machine.rs (1)
  • next (32-68)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Linux
  • GitHub Check: Linux / postcss
  • GitHub Check: Linux / vite
  • GitHub Check: Linux / upgrade

Copy link
Member

@RobinMalfait RobinMalfait left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but not sure about the !important.

Can you also add a changelog entry?

@thecrypticace
Copy link
Contributor Author

Yeah I was not gonna change that part. It's unrelated anyway. Will get the change log updated.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c19d255 and f381118.

📒 Files selected for processing (4)
  • CHANGELOG.md (1 hunks)
  • crates/oxide/src/extractor/arbitrary_property_machine.rs (3 hunks)
  • crates/oxide/src/extractor/pre_processors/ruby.rs (5 hunks)
  • crates/oxide/src/extractor/pre_processors/test-fixtures/haml/dst-17051.haml (0 hunks)
💤 Files with no reviewable changes (1)
  • crates/oxide/src/extractor/pre_processors/test-fixtures/haml/dst-17051.haml
🧰 Additional context used
🧬 Code graph analysis (1)
crates/oxide/src/extractor/pre_processors/ruby.rs (2)
crates/oxide/src/extractor/candidate_machine.rs (1)
  • next (29-169)
crates/oxide/src/extractor/string_machine.rs (1)
  • next (32-68)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Linux
  • GitHub Check: Linux / cli
  • GitHub Check: Linux / upgrade
  • GitHub Check: Linux / postcss
  • GitHub Check: Linux / vite
  • GitHub Check: Linux / webpack

Comment on lines +121 to +142
// Replace comments in Ruby files
b'#' => {
result[cursor.pos] = b' ';
cursor.advance();

while cursor.pos < len {
match cursor.curr {
// End of the comment
b'\n' => break,

// Everything else is part of the comment and replaced
_ => {
result[cursor.pos] = b' ';
cursor.advance();
}
};
}

cursor.advance();
continue;
}

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Avoid clobbering percent literals when stripping comments.

Treating every # outside of quoted strings as the start of a comment nukes valid Ruby percent literals like %r#foo#bar# or %i#klass#, because this loop replaces everything from the delimiter onward with spaces. After preprocessing, the literal body is gone and the extractor can’t see classes tucked inside. Please keep %r/%i/%s-style delimiters (and similar % forms) intact—e.g., bail out of the comment branch when the # immediately follows a %[a-zA-Z] sequence—so we only blank true comments.

🤖 Prompt for AI Agents
In crates/oxide/src/extractor/pre_processors/ruby.rs around lines 121 to 142,
the comment-stripping branch treats every '#' as the start of a comment and thus
clobbers Ruby percent-literals like %r#...# or %i#...#; change the branch to
detect when the '#' is actually the delimiter of a percent-literal and skip
comment removal in that case. Concretely, before turning the '#' into a space
and entering the comment loop, check the two bytes immediately before cursor (or
the original buffer at cursor.pos-2 and cursor.pos-1) and if they form '%'
followed by an ASCII letter (/[A-Za-z]/) then do not treat this '#' as a comment
(bail out of the comment branch and continue normal scanning), otherwise proceed
with the existing comment-blanking logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tailwind v4 parsing warnings when scanning Rails gem source files on Heroku

3 participants